package com.zyf.controller;

import com.zyf.common.result.Result;
import com.zyf.model.hosp.Schedule;
import com.zyf.service.ScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/** 医院排班详细信息接口
 * @author zyf
 * @date 2021年05月13日 18:12
 */
@Api(value = "医院排班详细信息接口")
@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleDetailsController {

    @Autowired
    private ScheduleService scheduleService;

    @ApiOperation(value = "根据医院编号和科室编号，查询排班规则数据API")
    @GetMapping("/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "当前页"),
            @ApiImplicitParam(name = "limit", value = "页面显示记录数"),
            @ApiImplicitParam(name = "hoscode", value = "医院编号"),
            @ApiImplicitParam(name = "depcode", value = "科室编号")
    })
    public Result getScheduleRule(@PathVariable Integer page,
                                  @PathVariable Integer limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode
    ){
        Map<String,Object> map= scheduleService.getScheduleRule(page,limit,hoscode,depcode);
        return Result.ok(map);
    }


    @ApiOperation(value = "根据医院编号、科室编号和工作日期，查询排班详细信息")
    @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "hoscode", value = "医院编号"),
            @ApiImplicitParam(name = "depcode", value = "科室编号"),
            @ApiImplicitParam(name = "workDate", value = "工作日期")
    })
    public Result getScheduleDetail(@PathVariable String hoscode,
                                    @PathVariable String depcode,
                                    @PathVariable String workDate
    ){
        List<Schedule> list = scheduleService.getScheduleDetail(hoscode,depcode,workDate);
        return Result.ok(list);
    }
}
